<template>
  <div class="recreation-container">
    <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
      <van-list
        v-model:loading="loading"
        :finished="finished"
        finished-text="没有更多了"
        @load="onLoad"
      >
        <van-cell v-for="item in list" :key="item" style="background: #F5F6F7">
          <div class="card" @click="showtk = true">
            <img src="/src/img/student/studen.png" class="cardImage"/>
            <div class="commentOnHomework">
              <div class="cardleft">班级名称名称名称</div>
              </div>
            <div class="cardCenter">
              <div class="cardCenterNeer">
                <div class="cardLeft">课程日历</div>
                <div class="cardRight">2024-12-01</div>
              </div>
              <div class="cardCenterNeer">
                <div class="cardLeft">班级</div>
                <div class="cardRight">测试</div>
              </div>
            </div>
          </div>
        </van-cell>
      </van-list>
    </van-pull-refresh>
  </div>
</template>

<script>
export default {
  mounted() {
  },
  setup() {
    //下拉列表
    const list = ref([]);
    const loading = ref(false);
    const finished = ref(false);
    const refreshing = ref(false);
    const onLoad = () => {
      setTimeout(() => {
        if (refreshing.value) {
          list.value = [];
          refreshing.value = false;
        }
        for (let i = 0; i < 10; i++) {
          list.value.push(list.value.length + 1);
        }
        loading.value = false;
        if (list.value.length >= 40) {
          finished.value = true;
        }
      }, 1000);
    };
    const onRefresh = () => {
      finished.value = false;
      loading.value = true;
      onLoad();
    };
    return {
      refreshing,
      list,
      loading,
      finished,
      onRefresh,
      onLoad,
    };
  },
  methods: {},
}
</script>

<style scoped lang="less">
.van-cell {
  padding: 19px 16px 0px;
}

.cardImage{
  width: 65px;
  height: 29px;
  position: absolute;
  top:0px;
  right: 0px;
}
.card {
  border-radius: 8px;
  background-color: #fff;
  display: flex;
  flex-direction: column;

  .commentOnHomework {
    display: flex;
    align-items: center;
    padding: 12px;
    font-family: PingFangSC, PingFang SC;
    font-weight: 400;
    font-size: 16px;
    color: #333333;
    line-height: 22px;
    text-align: left;
    font-style: normal;
    border-bottom: 1px solid #E9E9E9;
    justify-content: space-between;

    .cardleft {
      display: flex;
      align-items: center;
    }

    img {
      width: 13px;
      margin-right: 6px;
      height: 15px;
    }
  }

  .cardCenter {
    padding-bottom: 17px;
  }

  .cardCenterNeer {
    display: flex;
    font-family: PingFangSC, PingFang SC;
    font-weight: 400;
    font-size: 14px;
    color: #333333;
    line-height: 20px;
    text-align: left;
    font-style: normal;
    margin: 12px 12px 0px;

    .cardLeft {
      font-family: PingFangSC, PingFang SC;
      font-weight: 400;
      font-size: 14px;
      color: #333333;
      line-height: 20px;
      text-align: left;
      font-style: normal;
      margin-right: 30px;
      width: 60px;
    }

    .cardRight {
      font-family: PingFangSC, PingFang SC;
      font-weight: 400;
      font-size: 14px;
      color: #666666;
      line-height: 20px;
      text-align: left;
      font-style: normal;
    }
  }

  .left {
    width: 80px;
    height: 80px;
    overflow: hidden;
    border-radius: 5px;
    background-color: pink;
    margin-right: 10px;
  }

  .cardBottom {
    display: flex;
    justify-content: flex-end;
    margin: 14px 16px 0px;

    .leftimg {
      width: 93px;
      height: 30px;
      margin-left: 6px;
    }

    .rightimg {
      width: 70px;
      height: 30px;
      margin-left: 6px;
    }
  }

}
</style>
